
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>php基础语法 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="03_php变量.html" />
    
    
    <link rel="prev" href="01_php介绍.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="01_php介绍.html">
            
                <a href="01_php介绍.html">
            
                    
                    php基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="01_php介绍.html">
            
                <a href="01_php介绍.html">
            
                    
                    php介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.2" data-path="02_PHP基础语法.html">
            
                <a href="02_PHP基础语法.html">
            
                    
                    php基础语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="03_php变量.html">
            
                <a href="03_php变量.html">
            
                    
                    php变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="04_php数据类型.html">
            
                <a href="04_php数据类型.html">
            
                    
                    php数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="05_php常量.html">
            
                <a href="05_php常量.html">
            
                    
                    php常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="06_php运算符.html">
            
                <a href="06_php运算符.html">
            
                    
                    php运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="07_php流程控制.html">
            
                <a href="07_php流程控制.html">
            
                    
                    php流程控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="08_php数组.html">
            
                <a href="08_php数组.html">
            
                    
                    php数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="09_php函数.html">
            
                <a href="09_php函数.html">
            
                    
                    php函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="10_php面向对象.html">
            
                <a href="10_php面向对象.html">
            
                    
                    php面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="11_php命名空间.html">
            
                <a href="11_php命名空间.html">
            
                    
                    php命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.12" data-path="12_php日期和时间.html">
            
                <a href="12_php日期和时间.html">
            
                    
                    php日期时间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.13" data-path="13_php表单.html">
            
                <a href="13_php表单.html">
            
                    
                    php表单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.14" data-path="14_php包含文件.html">
            
                <a href="14_php包含文件.html">
            
                    
                    php包含文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.15" data-path="15_php常用函数.html">
            
                <a href="15_php常用函数.html">
            
                    
                    php常用函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.16" data-path="../php高级/16_php常用变量函数.md">
            
                <span>
            
                    
                    php常用变量函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../php高级/01_php错误与异常.html">
            
                <a href="../php高级/01_php错误与异常.html">
            
                    
                    php错误与异常
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../php高级/02_PhpStorm本地断点调试.html">
            
                <a href="../php高级/02_PhpStorm本地断点调试.html">
            
                    
                    PhpStorm本地断点调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../php高级/03_php文件操作.html">
            
                <a href="../php高级/03_php文件操作.html">
            
                    
                    php文件操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../php高级/04_cookie机制.html">
            
                <a href="../php高级/04_cookie机制.html">
            
                    
                    cookie机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../php高级/05_session.html">
            
                <a href="../php高级/05_session.html">
            
                    
                    session
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../php高级/06_php画图.html">
            
                <a href="../php高级/06_php画图.html">
            
                    
                    php画图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../php高级/07_php加密机制.html">
            
                <a href="../php高级/07_php加密机制.html">
            
                    
                    php加密机制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >php基础语法</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <blockquote>
<p>PHP &#x811A;&#x672C;&#x5728;&#x670D;&#x52A1;&#x5668;&#x4E0A;&#x6267;&#x884C;&#xFF0C;&#x7136;&#x540E;&#x5C06;&#x7EAF; HTML &#x7ED3;&#x679C;&#x53D1;&#x9001;&#x56DE;&#x6D4F;&#x89C8;&#x5668;&#x3002;</p>
</blockquote>
<h2 id="php-&#x8BED;&#x6CD5;">PHP &#x8BED;&#x6CD5;</h2>
<p>PHP &#x811A;&#x672C;&#x53EF;&#x4EE5;&#x653E;&#x5728;&#x6587;&#x6863;&#x4E2D;&#x7684;&#x4EFB;&#x4F55;&#x4F4D;&#x7F6E;&#x3002;</p>
<p>PHP &#x811A;&#x672C;&#x4EE5; &lt;?php &#x5F00;&#x59CB;&#xFF0C;&#x4EE5; ?&gt; &#x7ED3;&#x675F;&#xFF1A;</p>
<pre><code>&lt;?php
// PHP &#x4EE3;&#x7801;
?&gt;
</code></pre><blockquote>
<p>PHP &#x6587;&#x4EF6;&#x7684;&#x9ED8;&#x8BA4;&#x6587;&#x4EF6;&#x6269;&#x5C55;&#x540D;&#x662F; &quot;.php&quot;&#x3002;</p>
</blockquote>
<p>PHP &#x6587;&#x4EF6;&#x901A;&#x5E38;&#x5305;&#x542B; HTML &#x6807;&#x7B7E;&#x548C;&#x4E00;&#x4E9B; PHP &#x811A;&#x672C;&#x4EE3;&#x7801;&#x3002;</p>
<p>&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;

&lt;h1&gt;My first PHP page&lt;/h1&gt;

&lt;?php
echo &quot;Hello World!&quot;;
?&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre><blockquote>
<p>&#x6CE8;&#x610F;&#xFF1A;PHP &#x4E2D;&#x7684;&#x6BCF;&#x4E2A;&#x4EE3;&#x7801;&#x884C;&#x90FD;&#x5FC5;&#x987B;&#x4EE5;&#x5206;&#x53F7;&#x7ED3;&#x675F;&#x3002;&#x5206;&#x53F7;&#x662F;&#x4E00;&#x79CD;&#x5206;&#x9694;&#x7B26;&#xFF0C;&#x7528;&#x4E8E;&#x628A;&#x6307;&#x4EE4;&#x96C6;&#x533A;&#x5206;&#x5F00;&#x6765;&#x3002;</p>
</blockquote>
<h2 id="php-&#x4E2D;&#x7684;&#x6CE8;&#x91CA;">PHP &#x4E2D;&#x7684;&#x6CE8;&#x91CA;</h2>
<p>PHP&#x4E2D;&#x7ED9;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x4E86;&#x4E24;&#x79CD;&#x6CE8;&#x91CA;&#xFF1A;&#x5355;&#x884C;&#x6CE8;&#x91CA;&#x3001;&#x591A;&#x884C;&#x6CE8;&#x91CA;</p>
<pre><code>// &#x8FD9;&#x662F; PHP &#x5355;&#x884C;&#x6CE8;&#x91CA;

# &#x8FD9;&#x662F; PHP &#x5355;&#x884C;&#x6CE8;&#x91CA;

/*
    &#x8FD9;&#x662F;
    PHP &#x591A;&#x884C;
    &#x6CE8;&#x91CA;
*/
</code></pre><h2 id="php&#x6807;&#x8BC6;&#x7B26;">PHP&#x6807;&#x8BC6;&#x7B26;</h2>
<ol>
<li>&#x6807;&#x8BC6;&#x7B26;&#x957F;&#x5EA6;&#x53EF;&#x4EE5;&#x662F;&#x4EFB;&#x610F;&#x7684;&#xFF0C;&#x7531;&#x5B57;&#x6BCD;&#x3001;&#x6570;&#x5B57;&#x3001;&#x4E0B;&#x5212;&#x7EBF;&#x7EC4;&#x6210;&#xFF0C;&#x4F46;&#x4E0D;&#x80FD;&#x4EE5;&#x6570;&#x5B57;&#x5F00;&#x5934;</li>
<li>&#x5728;PHP&#x4E2D;&#xFF0C;&#x6807;&#x8BC6;&#x7B26;&#x533A;&#x5206;&#x5927;&#x5C0F;&#x5199;($Eduask&#x4E0E;$eduask&#x662F;&#x4E0D;&#x540C;&#x7684;),&#x4F46;&#x662F;&#x51FD;&#x6570;&#x540D;&#x79F0;&#x662F;&#x4E2A;&#x4F8B;&#x5916;&#xFF0C;&#x5B83;&#x53EF;&#x4EE5;&#x4EFB;&#x610F;&#x5927;&#x5C0F;&#x5199;</li>
<li>&#x6807;&#x8BC6;&#x7B26;&#x4E0D;&#x9700;&#x8981;&#x5B9A;&#x4E49;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528;</li>
<li>&#x907F;&#x514D;&#x53D8;&#x91CF;&#x540D;&#x79F0;&#x4E0E;&#x51FD;&#x6570;&#x540D;&#x79F0;&#x76F8;&#x540C;&#xFF0C;&#x867D;&#x7136;&#x53D8;&#x91CF;&#x540D;&#x79F0;&#x4E0E;&#x51FD;&#x6570;&#x540D;&#x79F0;&#x76F8;&#x540C;&#x65F6;&#x5141;&#x8BB8;&#x7684;&#xFF0C;&#x4F46;&#x662F;&#x5BB9;&#x6613;&#x6DF7;&#x6DC6;&#xFF0C;&#x4ECE;&#x800C;&#x5BFC;&#x81F4;&#x4F20;&#x53C2;&#x9519;&#x8BEF;</li>
</ol>
<h2 id="php4&#x4E2D;&#x4E0D;&#x540C;&#x8F93;&#x51FA;&#x8BED;&#x53E5;">PHP4&#x4E2D;&#x4E0D;&#x540C;&#x8F93;&#x51FA;&#x8BED;&#x53E5;</h2>
<ol>
<li>echo &#x5E38;&#x7528;&#x7684;&#x8F93;&#x51FA;&#x8BED;&#x53E5;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;<code>echo &apos;helloworld&#xFF01;&apos;</code>;</li>
<li><code>print()</code> &#x8F93;&#x51FA;&#x8BED;&#x53E5;&#xFF0C;&#x6709;&#x8FD4;&#x56DE;&#x503C;&#x3002;&#x4F8B;&#x5982;&#xFF1A;<code>print(&apos;helloworld&#xFF01;&apos;);</code> &#x8F93;&#x51FA;&#x6210;&#x529F;&#x8FD4;&#x56DE;1&#xFF0C;&#x5931;&#x8D25;&#x8FD4;&#x56DE;0&#x3002;</li>
<li><code>printf();</code> &#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;&#x5B57;&#x7B26;&#x4E32;&#x3002;&#x4F8B;&#x5982;&#xFF1A;<code>printf(&quot;%d,%f&quot;,12,12.3);</code></li>
<li><code>print_r();</code> &#x8F93;&#x51FA;&#x6570;&#x7EC4;&#x3001;&#x5BF9;&#x8C61;&#x7B49;&#x590D;&#x5408;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x3002;&#x4F8B;&#x5982;&#xFF1A;<code>print_r($array);</code></li>
<li><code>var_dump();</code> &#x53EF;&#x4EE5;&#x5224;&#x65AD;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;&#x4E0E;&#x957F;&#x5EA6;,&#x5E76;&#x8F93;&#x51FA;&#x53D8;&#x91CF;&#x7684;&#x6570;&#x503C;&#x3002;&#x4F8B;&#x5982;&#xFF1A;<code>var_dump(&apos;helloworld&#xFF01;&apos;);</code></li>
</ol>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="01_php介绍.html" class="navigation navigation-prev " aria-label="Previous page: php介绍">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="03_php变量.html" class="navigation navigation-next " aria-label="Next page: php变量">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"php基础语法","level":"1.2.2","depth":2,"next":{"title":"php变量","level":"1.2.3","depth":2,"path":"php/php基础/03_php变量.md","ref":"./php/php基础/03_php变量.md","articles":[]},"previous":{"title":"php介绍","level":"1.2.1","depth":2,"path":"php/php基础/01_php介绍.md","ref":"./php/php基础/01_php介绍.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"php/php基础/02_PHP基础语法.md","mtime":"2020-04-23T09:59:52.382Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-23T11:06:38.883Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

